#ifndef MainWidget_H
#define MainWidget_H

#include <QWidget>
#include <QTableView>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QMessageBox>
#include <QHeaderView>
#include <QFileDialog>
#include <QApplication>
#include "customtablemodel.h"
#include "doctypedelegate.h"
#include "operationdelegate.h"
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWidget;
}
QT_END_NAMESPACE

class MainWidget : public QWidget
{
    Q_OBJECT

public:
    MainWidget(QWidget *parent = nullptr);
    ~MainWidget();

private slots:
    void onAddItem();
    void onRemoveItem();
    void onChangeStatus();
    void onAddIcon();
    void onUploadClicked(int row);
    void onDeleteClicked(int row);
    void onViewClicked(int row);

private:
    //初始化视图
    void setupUI();
    void setupConnections();
    void initData();
    void setupStyles();

    // 视图
    QTableView *m_tableView;
    //模型
    CustomTablemodel *m_tableModel;
    //我们的委托下拉框列
    DocTypeDelegate *m_docTypeDelegate;
    //我们的委托操作列
    OperationDelegate *m_operationDelegate;

    //增加按钮
    QPushButton *m_btnAdd;
    //删除选中行按钮
    QPushButton *m_btnRemove;
    //切换状态按钮
    QPushButton *m_btnChangeStatus;
    //添加图标按钮
    QPushButton *m_btnAddIcon;

    // 布局管理器
    QVBoxLayout *m_mainLayout;
    QHBoxLayout *m_buttonLayout;

    //计数器
    int m_itemCounter;

private:
    Ui::MainWidget *ui;
};
#endif // MainWidget_H
